package com.osmino.contacts.list;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.osmino.contacts.R;
import com.osmino.contacts.entity.Email;
import com.osmino.core.utils.view.Backgroung;

public final class ContactViewEmailItem extends ContactViewBaseItem {

	public ContactViewEmailItem(Context context, IContactViewController controller) {
		super(context, controller);
	}

	private Email mEmail;
	
	public void setEmail(Email email) {
		mEmail = email;
		setText1(mEmail.address);
		setText2(mEmail.label);
	}

	@Override
	public void onClick(View view) {
		int viewId = view.getId();
		switch (viewId) {
			case R.id.contact_view_iv2:
				mController.onEmailButtonClick(mEmail);
				break;
		}
	}

	@Override
	public void setImagesTo(ImageView iv1, ImageView iv2) {
		iv1.setImageDrawable(null);
		Backgroung.setResource(iv2, R.drawable.contact_view_email_ic,
				R.drawable.contact_view_email_ic_active);
	}

}
